package com.smartwebx.ha.biz.assign.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smartwebx.ha.biz.assign.HaReportAreaManager;
import com.smartwebx.ha.dal.assign.bean.HaReportArea;
import com.smartwebx.ha.dal.assign.bean.HaReportAreaExample;
import com.smartwebx.ha.dal.assign.dao.HaReportAreaMapper;
/**
 * 
 * 创建人：Dream~天涯 
 * 创建时间：2015-4-21 下午8:19:45
 * 邮箱：154494796@qq.com
 * 备注：
 */
@Service
public class HaReportAreaManagerImpl implements HaReportAreaManager{
	@Autowired
	private HaReportAreaMapper haReportAreaMapper;
	@Override
	public int insert(HaReportArea haReportArea) {
		return this.haReportAreaMapper.insertSelective(haReportArea);
	}
	@Override
	public int delete(int reportId) {
		HaReportAreaExample haReportAreaExample = new HaReportAreaExample();
		com.smartwebx.ha.dal.assign.bean.HaReportAreaExample.Criteria haReportAreaCriteria = haReportAreaExample.createCriteria();
		haReportAreaCriteria.andPageIdEqualTo(reportId);
		return this.haReportAreaMapper.deleteByExample(haReportAreaExample);
	}
	@Override
	public List<HaReportArea> getReportAreaData(String type, Integer param1) {
		HaReportAreaExample haReportAreaExample = new HaReportAreaExample();
		com.smartwebx.ha.dal.assign.bean.HaReportAreaExample.Criteria haReportAreacriteria = haReportAreaExample.createCriteria();
		if("areaId".equals(type)){
			haReportAreacriteria.andAreaIdEqualTo(param1);
		}else if("pageId".equals(type)){
			haReportAreacriteria.andPageIdEqualTo(param1);
		}
		List<HaReportArea> haReportAreas = haReportAreaMapper.selectByExample(haReportAreaExample);
		return haReportAreas;
	}
	
}
